package org.nepu.srr.设备设施资料.动力及辅助设备证书;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.CommonIn;
import org.nepu.sc.domain.CommonMethods;

@Data
public class B45PowerParams {
    @ApiModelProperty("主柴油发电机组")
    CommonIn mainSteamGeneratorGroup;

    @ApiModelProperty("应急柴油发电机组")
    CommonIn emergencySteamGeneratorGroup;

    @ApiModelProperty("整流及变频电控装置")
    CommonIn powerControlDevice;

    @ApiModelProperty("启动空气压缩机")
    CommonIn startAirCompressor;

    @ApiModelProperty("服务空气压缩机")
    CommonIn serviceAirCompressor;

    @ApiModelProperty("呼吸器压缩机")
    CommonIn breathingAirCompressor;

    @ApiModelProperty("船用冷藏装置")
    CommonIn shipRefrigerationDevice;

    @ApiModelProperty("空调系统")
    CommonIn airConditioningSystem;

    @ApiModelProperty("泵类（压载泵、主海水泵、污水泵、电潜泵）")
    CommonIn pumpClass;

    @ApiModelProperty("造水机")
    CommonIn waterPump;

    @ApiModelProperty("吊车、行吊、电葫芦")
    CommonIn anchorChainRowBoatDugout;

    @ApiModelProperty("各种气动/液压绞车")
    CommonIn hydraulicUnloader;

    @ApiModelProperty("系物器件")
    CommonIn fastenerPart;

    @ApiModelProperty("被系物器件")
    CommonIn fastenerPartAttached;

    @ApiModelProperty("升降系统（电机、齿轮箱、刹车、齿条、环梁、环梁销、防震胶、液压系统）")
    CommonIn elevatorSystem;

    @ApiModelProperty("锁紧装置（齿条、液压系统）")
    CommonIn fasteningDevice;

    @ApiModelProperty("直升机甲板")
    CommonIn airplaneHull;

    @ApiModelProperty("飞机加油装置")
    CommonIn airplaneFuelSystem;

    @ApiModelProperty("飞机油罐")
    CommonIn airplaneOilTank;

    @ApiModelProperty("锅炉和空压机安全阀")
    CommonIn oilPressSafetyValve;

    @ApiModelProperty("仪表")
    CommonIn instrument;

    @ApiModelProperty("叉车")
    CommonIn crane;

    public B45PowerResult rate(){
        double fullScore = 155;
        double score = 0;
        if(CommonMethods.isAllTrue(mainSteamGeneratorGroup.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(emergencySteamGeneratorGroup.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(powerControlDevice.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(startAirCompressor.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(serviceAirCompressor.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(breathingAirCompressor.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(shipRefrigerationDevice.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(airConditioningSystem.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(pumpClass.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(waterPump.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(anchorChainRowBoatDugout.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(hydraulicUnloader.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(fastenerPart.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(fastenerPartAttached.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(elevatorSystem.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(fasteningDevice.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(airplaneHull.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(airplaneFuelSystem.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(airplaneOilTank.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(oilPressSafetyValve.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(instrument.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(crane.getInput())){
            score += 10;
        }
        double rate = score / fullScore;
        B45PowerResult result = new B45PowerResult();
        result.setRateScore(rate);
        String s = CommonMethods.toGrade(rate);
        result.setRateResult(s);
        return result;
    }
}
